﻿<UserControl x:Class="DiscoveryLogic.Analytics.Modules.DataNavigation.RuleTreeView"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:BusinessLogic="clr-namespace:DiscoveryLogic.Analytics.BusinessLogic;assembly=Analytics.BusinessLogic"
    HorizontalAlignment="Stretch" VerticalAlignment="Stretch" MinHeight="400" MinWidth="100">
    <UserControl.ContextMenu>
        <ContextMenu x:Name="cmuRules" Opened="cmuRules_Opened">
            <MenuItem 
                x:Name="cmu_NewImportRule"
                Click="cmu_NewImportRule_Click"
                Header="New import rule"
                Tag="../images/import.png"/>
            <MenuItem 
                x:Name="cmu_NewLinkRule"
                Click="cmu_NewLinkRule_Click"
                Header="New link rule"
                Tag="../images/link.png"/>
            <MenuItem 
                x:Name="cmu_NewDedupRule"
                Click="cmu_NewDedupRule_Click"
                Header="New dedup rule"
                Tag="../images/dedup.png"/>
            <MenuItem 
                x:Name="cmu_NewClusterRule"
                Click="cmu_NewClusterRule_Click"
                Header="New dedup rule"
                Tag="../images/cluster.png"/>
            <MenuItem 
                x:Name="cmu_OpenRule"
                Click="cmu_OpenRule_Click"
                Header="Open rule"
                Tag="../images/dedup.png"/>
            <MenuItem 
                x:Name="cmu_DeleteRule"
                Click="cmu_DeleteRule_Click"
                Header="Delete rule"
                Tag="../images/delete.png"/>
            <MenuItem 
                x:Name="cmu_RenameRule"
                Click="cmu_RenameRule_Click"
                Header="Rename rule"
                Tag="../images/rename.png"/>
        </ContextMenu>
    </UserControl.ContextMenu>
    <TreeView 
        x:Name="treeRules" 
        ItemsSource="{x:Static BusinessLogic:MyData.AllRules}"
        SelectedItemChanged="treeRules_SelectedItemChanged"
        HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
        BorderBrush="White" BorderThickness="0" MinWidth="100" MinHeight="400">
        <TreeView.ItemTemplate>
            <HierarchicalDataTemplate ItemsSource="{Binding Path=Rules}">
                <StackPanel Orientation="Horizontal">
                    <Image Source="/images/folder.ico" Width="16" Margin="0,0,5,0"/>
                    <TextBlock Text="{Binding Path=RuleType}" FontWeight="Bold"/>
                </StackPanel>
                <HierarchicalDataTemplate.ItemTemplate>
                    <DataTemplate>
                        <StackPanel Orientation="Horizontal">
                            <Image Source="{Binding Path=IconPath}" Width="16" Margin="0,0,5,0"/>
                            <TextBlock Text="{Binding Path=RuleName}"/>
                        </StackPanel>
                    </DataTemplate>
                </HierarchicalDataTemplate.ItemTemplate>
            </HierarchicalDataTemplate>
        </TreeView.ItemTemplate>
    </TreeView>
</UserControl>
